/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.model.events;

import java.util.Map;

/**
 * <p>This is a subclass of XREEvent that represents the "onReadLocalObject" event. It defines some properties specific
 * to this event. Note that values of all custom properties are actually stored in the XREEvent#params map.</p>
 *
 * <p><strong>Thread safety:</strong> This class is mutable and not thread safe.</p>
 *
 * @author saarixx, jmn
 * @version 1.0
 */
public class XREApplicationReadLocalObjectEvent extends XREApplicationEvent {

    /**
     * <p>Represents the name of the "on read local object event" event.</p>
     *
     * <p>This is a string constant used by the user when setting the name of the event.</p>
     */
    public static final String ON_READ_LOCAL_OBJECT_EVENT_NAME = "onReadLocalObject";

    /**
     * <p>Represents the name used to retrieve the local object parameter.</p>
     */
    private static final String LOCAL_OBJECT = "localObject";

    /**
     * <p>Creates new instance of {@link XREApplicationReadLocalObjectEvent} class.</p>
     */
    public XREApplicationReadLocalObjectEvent() {
        // empty constructor
    }

    /**
     * <p>Retrieves the map containing the receiver's local object properties for this application.</p>
     *
     * @return the map containing the receiver's local object properties for this application
     *
     * @throws IllegalStateException if the requested parameter has wrong type in the parameters map or if params is
     *                               null
     */
    @SuppressWarnings("unchecked")
    public Map<String, Object> getLocalObject() {
        return getTypedParam(LOCAL_OBJECT, Map.class);
    }

    /**
     * <p>Sets the map containing the receiver's local object properties for this application.</p>
     *
     * @param localObject the map containing the receiver's local object properties for this application
     *
     * @throws IllegalStateException if params is null
     */
    public void setLocalObject(Map<String, Object> localObject) {

        setParam(LOCAL_OBJECT, localObject);
    }
}

